import { createRouter, createWebHistory } from "vue-router";

const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/index",
    name: "index",
    component: () => import("../views/Index.vue"),
    children: [
      {
        path: "/home",
        name: "home",
        component: () => import("../views/Home.vue"),
      },
      {
        path: "/cate",
        name: "cate",
        component: () => import("../views/Cate.vue"),
      },
      {
        path: "/shopcar",
        name: "shopcar",
        component: () => import("../views/Shopcar.vue"),
      },
      {
        path: "/my",
        name: "my",
        component: () => import("../views/My.vue"),
      },
    ],
  },
  {
    path: "/detail/:id",
    name: "detail",
    component: () => import("../views/Detail.vue"),
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
